<template>
  <div class="my-dialog" v-show="value">
    <div class="content">
      <p class="title">{{ title }}</p>
      <div class="btns">
        <MyButton type="primary" @click="handleTip"></MyButton>
        <MyButton type="success" value="取消" @click="hideDialog"></MyButton>
      </div>
    </div>
  </div>
</template>

<script>
import MyButton from "./MyButton.vue";
export default {
  props: {
    value: {
      type: Boolean
    },
    title: String,
    showTooltip: Boolean
  },
  components: { MyButton },
  methods: {
    hideDialog() {
      this.$emit("input", false);
    },
    handleTip() {
      this.hideDialog();
      this.$emit("handleTip", "操作成功");
    }
  }
};
</script>

<style scoped>
.my-dialog {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  position: fixed;
  top: 0;
  left: 0;
}
.content {
  width: 85%;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px;
  justify-content: space-between;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 10px;
}
.btns {
  display: flex;
  justify-content: space-evenly;
  margin-top: 30px;
}
</style>